package ch.drshit.model.filter;

import java.awt.Color;

import ch.drshit.model.picture.Options;
import ch.drshit.model.picture.Version;

public class BaseFilter implements Runnable {

	private FilterListener listener;
	private Version version;

	protected BaseFilter(FilterListener l, Version v) {
		this.listener = l;
		this.version = v;
	}

	@Override
	public void run() {
		Options o = this.getFilterOptions();
		listener.ServeOptions(o, this);
	}

	public void startFilter(Options options) {
		this.listener.result();
	}

	protected Options getFilterOptions() {
		Options o = new Options();
		return o;
	}

	protected Version getVersion() {
		return this.version;
	}

	protected FilterListener getListener() {
		return this.listener;
	}

	// methode for all filters
	protected Color grey(Color c) {
		int grey = (c.getRed() + c.getGreen() + c.getBlue()) / 3;
		return new Color(grey,grey,grey);
	}

}
